package tcc.model.entities;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * Represents the Edges table
 * @author Gabriel Pacheco
 *
 */
@Entity
@Table(name="EDGES")
public class EdgeEntity implements Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private VertexEntity initialVertexId;
	private VertexEntity finalVertexId;
	private double distance;
	
	@Id
	@ManyToOne
	@JoinColumn(name="INITIAL_VERTEX_ID")
	public VertexEntity getInitialVertexId() {
		return initialVertexId;
	}
	public void setInitialVertexId(VertexEntity initialVertexId) {
		this.initialVertexId = initialVertexId;
	}
	
	@Id
	@ManyToOne
	@JoinColumn(name="FINAL_VERTEX_ID")
	public VertexEntity getFinalVertexId() {
		return finalVertexId;
	}
	public void setFinalVertexId(VertexEntity finalVertexId) {
		this.finalVertexId = finalVertexId;
	}
	
	@Column(name="DISTANCE", nullable=false)
	public double getDistance() {
		return distance;
	}
	public void setDistance(double distance) {
		this.distance = distance;
	}
}
